package cate.game.activity.firstpay.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBActivity;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "超值首充-领奖 请求")
@OperationSetter(value = GDOperation.ACT_SUPER_FIRST_PAY)
public class SuperFirstPayGetReq implements MsgInput {
    @NoteField(value = "挡位")
    public int level;

    @Override
    public MsgConfig conf() {
        return MsgIdBActivity.ACT_SUPER_FIRST_PAY_GET_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<Void> r = cc.getRole().getActivity().superFirstPay.getRewardByLevel(level);
        if (r.ok()) {
            cc.getRole().getActivity().superFirstPay.noticeUpdate();
        } else {
            game.notice.message(cc.getRole(), r.message);
        }
    }
}
